package csnd.xinghe.neo4j.server.common.enums;

public enum NodeTypeEnum {
    PERSON(1,"Person"),
    COMPANY(2,"Company"),
    ALL(0,"全部选中"),
    NOT_SET(-1,"未设置");

    private int key;
    private String value;

    NodeTypeEnum(int key, String value){
        this.key = key;
        this.value = value;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static NodeTypeEnum getNodeTypeEnum(int key) {
        return fromKey(key);
    }


    public static NodeTypeEnum fromKey(int key) {
        for (NodeTypeEnum nodeTypeEnum : NodeTypeEnum.values()) {
            if (nodeTypeEnum.getKey() == key) {
                return nodeTypeEnum;
            }
        }
        return null;
    }


    public static boolean contains(int key) {
        for (NodeTypeEnum nodeTypeEnum : NodeTypeEnum.values()) {
            if (nodeTypeEnum.getKey() == key) {
                return true;
            }
        }
        return false;
    }
}